package com.lagou;

import com.lagou.bean.Resume;
import com.lagou.repository.ResumeRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.Date;
import java.util.Random;

@SpringBootApplication
public class MongoRepositoryMain {
    public static void main(String[] args) {
        // 启动容器
        ApplicationContext applicationContext = SpringApplication.run(MongoRepositoryMain.class, args);
        // 获取MongoDB操作lg_resume_datas集合的对象
        ResumeRepository resumeRepository = applicationContext.getBean(ResumeRepository.class);

        // 新增100条记录
        for (int i = 0; i < 100; i++) {
            Resume resume = new Resume();
            resume.setName("test" + i);
            resume.setBirthday(new Date());
            resume.setExpectSalary(5);
            resume.setCity("hz");

            resumeRepository.save(resume);
        }


    }

}
